package com.zhengxyou.jetpackdemo.greenDao;

import android.content.Context;
import android.util.Log;

import org.greenrobot.greendao.database.Database;

public class DbOpenHelper extends DaoMaster.OpenHelper {
    public DbOpenHelper(Context context, String name) {
        super(context, name);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        super.onUpgrade(db, oldVersion, newVersion);
        Log.e("TAG", "DB_OLD_VERSION :" + oldVersion + ",DB_NEW_VERSION " + newVersion);
        switch (oldVersion) {
            case 1:
                break;
            case 2:
                db.execSQL("ALTER TABLE " + GUserDao.TABLENAME + " ADD COLUMN " + GUserDao.Properties.Name.columnName + " TEXT DEFAULT 'DEFAULT_VAL'");

                break;
        }
    }
}
